1. Field of the Invention
The present invention relates to a method of decoding bar codes and a bar code reader.
Many shops and supermarkets employ POS systems which include bar code readers. The bar code readers must read bar codes whose printed quality is not always good. Some bars of a bar code are thicker or thinner than standard widths, patchy, or partly broken due to poor printing quality. The bar code readers are required to read such poor-quality bar codes correctly.
2. Description of the Related Art
A UPC bar code is composed of start guard bars, center bars, and end guard bars. The center bars divide the bar code into two parts. A part between the start guard bars and the center bars is a left block, and a part between the center bars and the end guard bars is a right block. Each of the left and right blocks consists of six characters, and therefore, each bar code contains 12 characters. A photosensor for a bar code reader provides an electric signal representing "1" in response to reflected light from a black bar of the bar code, and an electric signal representing "0" in response to reflected light from a white bar of the bar code.
Each character of the bar code consists of two white bars and two black bars, and each character extends for seven modules. The module is a unit used to express the width of each bar of the bar code. The width of each white or black bar is an integral number of modules.
Each character of the bar code represents one of numerals 0 to 9 depending on the widths of the white and black bars of the character. Since each character consists of seven modules, the characters are classified into two groups. In one group, the total number of modules of the two black bars of each character is even, and in the other group, the same is odd. Consequently, each UPC bar code is able to express 20 characters, i.e., even-0 (E0) to even-9 (E9) each including an even number of black modules, and odd-0 (O0) to odd-9 (O9) each including an odd number of black modules, as shown in FIG. 3. The two character groups are used to distinguish, for example, the left and right blocks of the bar code from each other.
The bar code reader emits a scan beam toward a bar code and receives a beam reflected from the bar code. The bar code reader compares the intensity of the reflected beam with a reference value and provides an electric signal representing 1 or 0. A decoder of the bar code reader decodes the electric signal into one of E0 to E9 and O0 to O9 according to the level (1 or 0) and duration of the electric signal.
Each bar of the bar code is frequently too thin or too thick depending on printing conditions. The bar code reader is unable to test the printing conditions, and therefore, may erroneously read the bar code that is poorly printed if the bar code reader directly reads the width of each bar of the bar code.
To solve this problem, there is a bar code decoding method that cancels the influence of thicker and thinner bars when reading a bar code. This method measures the widths T1 and T2 of adjacent two pairs of black and white bars of the bar code as shown in FIG. 2.
The widths T1 and T2 are called delta distances. There are 20 characters ranging from E0 to E9 and O0 to O9 to be expressed in a bar code. On the other hand, there are four delta distances ranging from two to five modules to provide 16 combinations of T1 and T2. As a result, the characters E1 and E7 provide the same combination of T1 and T2. Similarly, E2 and E8, O1 and O7, and O2 and O8 provide the same combinations of T1 and T2, respectively. For these characters, the delta distances T1 and T2 are insufficient to distinguish them from one another.
The characters having the same combination of T1 and T2 have, however, different number of modules in individual bars. Accordingly, members of any one of the pairs E1 and E7, E2 and E8, O1 and O7, and O2 and O8 can be distinguished from each other by measuring the bars of the pair.
Here rises another problem that each bar of the pairs may also be thin or thick depending on printing conditions.
Then, measuring the widths of bars is insufficient to distinguish characters, for example, E1 and E7, having the same delta distances T1 and T2.
To solve this problem, there is a method of correcting the width of a bar of a character to be decoded, according to the width of a bar of the character that has already been decoded.
There is another method that sets an allowable error range for the width of a bar, determines whether or not each bar is within the range, and only when the bar is within the range, decodes the bar code.
If each bar has a large error, the allowable error range is expanded, to properly decode bar codes depending on situations.
This method, however, is complicated and is not preferable. There is no way to determine whether or not a corrected bar width is true. If the corrected bar width is wrong, the bar code reader will provide an incorrect result.
Recent bar codes are compact, short, and simply printed, and bar code readers are required to correctly read these bar codes.